Recording apparatus and method, recording medium and program

ABSTRACT

Present invention relates to a recording apparatus and method, a recording medium, and a program which are intended to enhance the speed of recording. On the basis of erasure block information and cluster information obtained from a Memory Stick  31 , the CPU  11  obtains the size of a data-block configured by clusters and, on the basis of the obtained data block size, adjusts the data block start position, thereby initializing the Memory Stick  31 . In recording moving-picture data to the Memory Stick  31 , the CPU  11  records the moving-picture data, in units of data blocks, to a data block of which clusters are all free. The present invention is applicable to camera-integrated video recorders or digital still cameras.

TECHNICAL FIELD

The present invention relates generally to a recording apparatus andmethod, a recording medium, and a program and, more particularly, to arecording apparatus and method, a recording medium, and a program whichare intended to enhance the speed of flash memory writing operations.

BACKGROUND ART

In flash memories, data are recorded or erased in units of blocks(erasure blocks). On the other hand, in computer systems based on anMS-DOS (trademark) OS (Operating System), a FAT (File Allocation Table)file system is usually used for recording and erasing data on their harddisks, so that the FAT file system is also often used for recording datato flash memories.

In the FAT file system, data are managed in units of a clusterconfigured by a plurality of sectors such as 4, 8, 16, or 32 forexample. Conventionally, the size of the cluster is greater than thesize of the erasure block of flash memories.

Recently, however, as the flash memory storage capacities increase, theerasure block size comes to exceed the maximum cluster size.

As the erasure block size exceeds the cluster size, the data of aplurality of clusters come to be stored in one erasure block, forexample. Consequently, rewriting the data of one cluster must once readthe data of one erasure block which contains that cluster (the data of aplurality of clusters), store these pieces of data into memory, rewritethe data of the cluster concerned in memory, and then write the data ofthe plurality of clusters which contain that cluster to the initial oneerasure block. This inevitably increases the time of the data writeoperation.

In order to manage flash memories having a large erasure block size, itis proposed to enlarge (over the erasure block size) the cluster size tobe managed by the FAT file system.

However, this approach involves a special FAT file system, therebylosing the compatibility with general-purpose personal computers usingthe conventional FAT file system. In addition, because one cluster isoccupied even by 1-byte data for example in the above-mentionedproposition, if the cluster size is enlarged and if 1-byte dataare-recorded for example, the wasted areas increase, thereby presentingproblems of a lowered memory usage efficiency for example.

DISCLOSURE OF INVENTION

It is therefore an object of the present invention to increase thewriting speed of flash memories while minimizing the lowered memoryusage efficiency.

In carrying out the invention and according to one aspect thereof, thereis provided a recording apparatus including first detecting means fordetecting the plurality of clusters which are free, second detectingmeans for detecting the erasure block in which the plurality of clustersare all free and recording means for recording data to the plurality ofclusters of the erasure block detected by the second detecting means.

In the above-mentioned recording apparatus, the recording memory may bea flash memory.

In the above-mentioned recording apparatus, a FAT system is formed inthe recording medium and the first detecting means detects the pluralityof free clusters from the FAT.

The above-mentioned recording apparatus further includes firstcalculation means for calculating a remaining free capacity of therecording medium from the number of the clusters detected by the firstdetecting means, and second calculation means for calculating aremaining free capacity of the recording medium from the number of theclusters of the erasure block detected by the second detecting means.

The above-mentioned recording apparatus further includes determiningmeans for determining whether or not data to be recorded to therecording medium is moving-picture data, wherein if the data to berecorded to the recording medium is found by the determining means to bemoving-picture data, then the recording means records the data to theplurality of clusters of the erasure block detected by the seconddetecting means.

The above-mentioned recording apparatus still further includesdetermining means for determining whether or not data to be recorded tothe recording medium is still-picture data, wherein if the data to berecorded to the recording medium is found by the determining means to bestill-picture data, then the recording medium records the data to theplurality of clusters detected by the first detecting means.

The above-mentioned recording medium yet further including display meansfor displaying a free remaining capacity of the recording mediumobtained by the first calculation means or the second calculation means.

The above-mentioned recording apparatus further includes: determiningmeans for determining whether or not data to be recorded to therecording medium is moving-picture data, wherein if the data to berecorded to the recording medium is found by the determining means to bemoving-picture data, then the display means displays the remaining freecapacity of the recording medium obtained by the second calculationmeans.

The above-mentioned recording apparatus still further includesdetermining means for determining whether or not data to be recorded tothe recording medium is still-picture data, wherein if the data to berecorded to the recording medium is found by the determining means to bestill-picture data, the display means displays the remaining freecapacity of the recording medium obtained by the first calculationmeans.

In carrying out the invention and according to another aspect thereof,there is provided a recording method including a first detecting stepfor detecting the plurality of clusters which are free, a seconddetecting step for detecting the erasure block in which the plurality ofclusters are all free, and a recording step for recording data to theplurality of clusters of the erasure block detected by the seconddetecting step.

In carrying out the invention and according to still another aspectthereof, there is provided a program for a recording medium including afirst detecting step for detecting the plurality of clusters which arefree, a second detecting step for detecting the erasure block in whichthe plurality of clusters are all free, and a recording step forrecording data to the plurality of clusters of the erasure blockdetected by the second detecting step.

In carrying out the invention and according to yet another aspectthereof, there is provided a program including a first detecting stepfor detecting the plurality of clusters which are free, a seconddetecting step for detecting the erasure block in which the plurality ofclusters are all free, and a recording step for recording data to theplurality of clusters of the erasure block detected by the seconddetecting step.

In the recording apparatus and method, the recording medium, and theprogram according to the invention, free clusters are detected and anerasure block of which clusters are all free is detected. Data isrecorded to the free clusters of the detected erasure block.

The recording apparatus may be an independent apparatus or a recordingblock of a recording/reproducing apparatus.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating an exemplary configuration of animaging apparatus to which the present invention is applied;

FIG. 2 is a block diagram illustrating the internal configuration of aMemory Stick shown in FIG. 1;

FIG. 3 is a diagram for describing a FAT file system;

FIG. 4 is a diagram for describing an example of FAT data in therecording processing shown in FIG. 6;

FIG. 5 is a flowchart for describing the initialization processing ofthe Memory Stick in the imaging apparatus shown in FIG. 1;

FIG. 6 is a diagram for describing the relationship between clusters andblocks;

FIG. 7 is a flowchart for describing the recording processing in theimaging apparatus shown in FIG. 1;

FIG. 8 is a diagram for describing another example of the FAT data inthe recording processing shown in FIG. 6; and

FIG. 9 is a diagram for describing still another example of the FAT datain the recording processing shown in FIG. 6.

BEST MODE FOR CARRYING OUT THE INVENTION

This invention will be described in further detail by way of examplewith reference to the accompanying drawings.

Now, referring to FIG. 1, there is shown an exemplary configuration ofan imaging apparatus 1 to which the present invention is applied. Theimaging apparatus 1 is configured by a camcorder (a camera-integratedvideo recorder) or a digital still camera (DSC) for example. In FIG. 1,a CPU (Central Processing Unit) 11 executes various processingoperations in accordance with a program stored in a ROM (Read OnlyMemory) 12 or a program loaded from a storage unit 20 into a RAM (RandomAccess Memory) 13. For the OS (Operating System) of the CPU 11, MS-DOS(trademark) is used. Further, the CPU 11 controls the imaging apparatus1 in its entirety in accordance with instructions entered by the userthrough an input unit 18. The RAM 13 also appropriately stores the datawhich are necessary for the CPU 11 to execute various processingoperations.

In the imaging apparatus 1, an object is imaged by an imaging unit 14and the corresponding moving-picture data or still-picture data areoutputted. The user may operate buttons for example constituting aninput unit 18 to select the moving-picture imaging mode or thestill-picture imaging mode (in what follows, the moving-picture imagingmode is referred to as the moving-picture mode and the still-pictureimaging mode as the still-picture mode), thereby executing an imagingoperation.

On the basis of the imaging mode selected by the user, the imaging unit14 takes a picture of an object and supplies its moving-image data orstill-image data to an image processing unit 15. The image processingunit 15 performs such image processing on the supplied data imaged bythe imaging unit 14 as color conversion, gamma correction, andresolution conversion.

The CPU 11, the ROM 12, and RAM 13, the imaging unit 14, and the imageprocessing unit 15 are interconnected via a bus 16. This bus 16 is alsoconnected to an input/output interface 17.

The input/output interface 17 is connected to the input unit 18 composedof buttons and dials for example, a display device constituted by a CRT(Cathode Ray Tube) or an LCD (Liquid Crystal Display), an output unit 19constituted by a speaker for example, a storage unit 20 constituted by ahard disk for example, and a communication unit 21 constituted by amodem and a terminal adaptor for example. The communication unit 21executes communication processing via a network (not shown).

The input/output interface 17 is also connected to a memory cardinterface (I/F) 30.

The memory card interface 30 performs initialization processing on aMemory Stick (trademark), 31 for example, which is a typical flashmemory, loaded thereon, on the basis of instructions by the CPU 11, andexecutes the processing of recording and reproducing the moving-picturedata or still-picture data taken by the imaging unit 14 and processed bythe image processing unit 15.

In the Memory Stick 31, data are recorded and erased in units of blocks(hereafter referred to as erasure blocks).

The input/output interface 17 is also connected to a drive 40 asrequired. On the drive 40, a magnetic disk 41, an optical disk 42, amagneto-optical disk 43, or a semiconductor memory 44 is loadedappropriately, computer programs read therefrom being installed in thestorage unit 20 as required.

Referring to FIG. 2, there is shown the internal configuration of theMemory Stick 31. It should be noted that, with reference to FIG. 2,similar components previously described with reference to FIG. 1 aredenoted by the same reference numerals and their description will beskipped for the sake of brevity.

The Memory Stick 31 is constituted by a CPU 101, an interface (I/F) 102,a flash memory 103, and a RAM 104.

The CPU 101 receives, via the interface 102, instructions by the CPU 11of the imaging apparatus 1 entered from the memory card interface 30 andcontrols the entire Memory Stick 31 accordingly. The CPU 101 stores datainto the flash memory 103 and initializes the flash memory 103 inaccordance with the instructions given by the CPU 11 of the imagingapparatus 1.

The RAM 104, under the control of the CPU 101, temporarily stores thedata stored in the Memory Stick 31 or the data stored in the flashmemory 103.

The following describes a FAT (File Allocation Table) file system, whichis a method of managing the data stored in the Memory Stick 31, withreference to FIG. 3. A plurality of FAT file systems may be created inthe Memory Stick 31. The Memory Stick 31 is divided into partitions, ineach of which one file system is arranged. In this example, onepartition is allocated to the Memory Stick 31, in which one FAT systemis formed.

The FAT file system uses two recording units of logical sector andcluster to manage the recording areas of each recording medium (in thisexample, the Memory Stick 31). Each of logical sectors is generally 512bytes wide, which are sequentially numbered starting from the head ofthe Memory Stick 31. On the other hand, each cluster is configured by aplurality of logical sectors (4, 8, 16, or 32 sectors).

Referring to FIG. 3, there is shown the relationship between the logicalarrangement of the FAT file system and the data area (clusters) in theMemory Stick 31.

The FAT file system is configured by an MBR (Master Boot Record) 51, aPBR (Partition Boot Record) 53, a FATI 54, a FATII 55, a root directory56, and a data area 57.

The MBR 51 is the data to be stored at the start address of the FAT filesystem. The MBR 51 includes such information unique to the Memory Stick31 as the information about each file system existing in the MemoryStick 31 and the information about each partition range of the MemoryStick 31. The data in the MBR 51 are rewritten every time the MemoryStick 31 is initialized and the allocation of partitions is performed.

The PBR 53 and on that follow a free area 52 are managed for eachpartition constituting the Memory Stick 31, so that there are the samenumber of these items as the number of partitions.

The PBR 53 is the data stored at the start address of each partitionformed in the Memory Stick 31. The PBR 53 includes address informationabout such areas in which the management information is stored as theFATI 54, the FATII 55, and the root directory 56, the addressinformation of the data area 57, and the information about thecorresponding partition.

The FATI 54 is an area in which the table data (FAT data) indicative ofthe usage status of each cluster in the data area 57 are stored. TheFATII 55 also stores a copy (namely, the same data) of the FATI 54. Theroot directory 56 stores the data indicative of the information aboutthe files in the root directory and the information about thesubdirectories in this Memory Stick 31;

The data area 57 is an area for storing data. The CPU 11 manages thedata area 57 on a cluster basis. Of the clusters in the data area 57managed by the CPU 11, cluster 0 and cluster 1 provide a area reservedby the OS, so that the clusters (cluster 2, cluster 3, and so on)starting with cluster 2, which are managed in their sequential numbers,provide an area in which data may be substantially recorded.

The following describes the FAT data of the FATI 54 which indicate theusage status of each cluster in the data area 57, with reference to FIG.4.

Referring to FIG. 4, there is shown the FAT data of the FATI 54 in a16-bit FAT system.

The FAT data are a table containing the information (entries) indicativein which cluster the continuation of data is entered for each cluster.Namely, entry c0, entry c1, entry c2, and so on store the informationabout the data stored in cluster 0, cluster 1, cluster 2, and so on inthe data area 57 respectively. The FAT data start with the data in entryc0 of cluster 0, which is the logical first cluster managed by the FATdata.

As shown in FIG. 4, entry c2 for example stores the data to be stored incluster 2 in the data area 57 and is configured by 2 bytes, “03” and“00” in this example. “03”, byte 1 of entry c2, indicates that thecontinued data are stored in cluster 3 (namely, the substantial value ofthe 2 bytes are represented in “00” “03” (0003) obtained by replacingthe first byte “03” with the last byte “00”). In the FAT data, if thecontinuation of data does not exist in the subsequent clusters, “ff”“ff” indicative of EOF (end of file) is written; in the case of an emptycluster, “00” “00” are written as shown in entry c18 for example.

It should be noted, because cluster 0 and cluster 1 are reserved by theOS, “f8” “ff” and “ff” “ff” are written to entries c0 and c1respectively. Namely, the logical first cluster managed by the FAT iscluster 0; actually, however, the information of data area 57 is writtenstarting with entry c2 (the entry of cluster 2).

Referring to FIG. 4, the value of entry c2 is “03” “00”, the value ofentry c3 is “04” “00”, the value of entry c4 is “07” “00”, the value ofentry c7 is “08” “00”, the value of entry c8 is “09” “00”, the value ofentry c9 is “0a” “00”, and the value of entry c10 is “ff” “ff”, so thatit is apparent that data 1 of which recording started with cluster 2 aresequentially stored in clusters 3, 4, 7, 8, 9, and 10. The value ofentry c5 is “06” “00”, the value of entry c6 is “0b” “00”, the value ofentry c11 is “0c” “00, the value of entry c12 is “0d” “00”, the value ofentry c13 is “0e” “00”, the value of entry 14 is “0f” “00”, the value ofentry c15 is “10” “00, and the value of entry c16 is “ff” “ff”, so thatit is apparent that data 2 of which recording started with cluster 5 aresequentially stored in clusters 6, 11, 12, 13, 14, 15, and 16. Further,the values of entry c17 and the subsequent entries are “00” “00”, sothat it is apparent that cluster 17 and subsequent clusters are freeareas.

It should be noted that addresses “0000”, “0010”, “0020”, and “0030”shown to the left of the figure indicate the internal addresses at whichthe data of the FATI 54 are written.

In order to create the above-mentioned FAT file system in the MemoryStick 31, the CPU 11 initializes the Memory Stick 31. The followingdescribes this initialization processing with reference to the flowchartshown in FIG. 5.

In order to initialize the Memory Stick 31, the user loads the MemoryStick 31 on the memory card interface 30 of the imaging apparatus 1.Upon detection of the loading of the Memory Stick 31, the CPU 11controls the memory card interface 30 to get the erasure blockinformation from the Memory Stick 31 in step S1. Namely, the CPU 101 ofthe Memory Stick 31 reads the erasure block size set internally to thedevice and outputs the erasure block size via the interface 102.Consequently, value 128 Kbytes is obtained as the erasure block size.

In step S2, the CPU 11 controls the memory card interface 30 to get thecluster information from the Memory Stick 31. For example, the CPU 101of the Memory Stick 31 reads the cluster size from the PBR 53 andoutputs the cluster size to the CPU 11. Consequently, a value of 32Kbytes is obtained for example.

In step S3, on the basis of the erasure block size obtained in step S1and the cluster size obtained in step S2, the CPU 11 obtains a datablock size. The data block size is represented by the number of clusterswhich form one erasure block. In step S4, on the basis of the data blocksize obtained in step S3, the CPU 11 adjusts the data block startposition and performs the initialization.

The following describes the details of the processing of above-mentionedsteps S3 and S4 with reference to FIG. 6.

In the present example, the data block size is 4 clusters because theerasure block size is 128 Kbytes obtained in step S1 and the clustersize is 32 Kbytes obtained in step S2. Therefore, in step S4, theprocessing is executed with 4 clusters in the data area 57 being 1 datablock (erasure block).

It should be noted that, for the convenience of description, the erasureblock and the data block are separately described; however, because acollection of clusters equivalent to the erasure block is regarded asthe data block, erasure block n+1 and data block 1 for example indicatethe same area.

The actual usage status of the data area 57 is written starting withentry c2 (the entry of cluster 2); however, because the FAT data of FATI54 logically start with entries c0 and c1 (the entry of cluster 0 andthe entry of cluster 1), the data block start position is adjusted suchthat the FAT data are matched with cluster 0, which is the logical firstcluster to be managed by the FAT. Namely, the 4 clusters (clusters 0through 3) including the data for the first 2 clusters (cluster 0 andcluster 1), which are the reserved area for the OS, provide 1 data blockand the processing is executed with the subsequent 4 clusters in thedata area 57 being 1 data block sequentially.

Therefore, as shown in FIG. 6, cluster 0 (reserved area)+cluster 1(reserved area)+cluster 2 (data area)+cluster 3 (data area) provide datablock 0 which is equivalent to erasure block n, and cluster 4 (dataarea)+cluster 5 (data area)+cluster 6 (data area)+cluster 7 (data area)provide data block 1 which is equivalent to erasure block n+1. Likewise,the subsequent every four clusters in the data area 57 provide 1 datablock sequentially.

The following describes the recording processing of the Memory Stick 31initialized as described above, with reference to the flowchart shown inFIG. 7.

In order to record the moving-picture data or the still-picture databeing taken to the Memory Stick 31, the user loads the Memory Stick 31on the memory card interface 30 of the imaging apparatus 1 and pressesthe record start button of the input unit 18. Upon detection of theloading of the Memory Stick 31, the CPU 11 controls the memory cardinterface 30 to get the erasure block information from the Memory Stick31 in step S31. For example, the CPU 101 of the Memory Stick 31 readsthe erasure block size (for example, 128 Kbytes) set to the device andinforms the CPU 11 of this erasure block size. At the same time, arecommended initialization parameter is supplied.

In step S32, the CPU 11 controls the memory card interface 30 to get thecluster information from the Memory Stick 31. For example, the value ofthe cluster size (for example, 32 Kbytes) is obtained from the PBR 53 ofthe Memory Stick 31.

In step S33, the CPU 11 determines on the basis of the recommendedinitialization parameter received in step S31 whether or not the MemoryStick 31 has been properly initialized. Namely, in step S33, whether ornot the initialization has been performed (the data block start positionhas been adjusted) as described with reference to the flowchart shown inFIG. 5 is determined.

If the Memory Stick 31 is found not properly initialized in step S33,then the CPU 11 displays, in step S34, that the Memory Stick 31 has notbeen properly initialized onto the monitor for example of the outputunit 19, thereby ending the recording processing.

It should be noted that, in this case, the recording processing isended; it will be apparent that the Memory Stick 31 may be initializedagain or the recording of moving-picture data may be prohibited.

If the Memory Stick 31 is found properly initialized in step S33, thenthe CPU 11 calculates the remaining capacity of the Memory Stick 31 forrecording the still-picture data (in the case of the still-picture mode)in step S35.

In the case of recording still-picture data in the imaging apparatus 1,the CPU 11 detects all free clusters from the FATI 54. To be morespecific, the clusters (in the example shown in FIG. 4, entries c17,c18, c19, c31, . . . ) with the value of entry Ci (i=0, 1, 2, . . . ) is“00” “00” are detected. In step S35, the remaining capacity of theMemory Stick 31 is calculated on the basis of the number of all detectedclusters.

Next, on the basis of the erasure block size (128 Kbytes) obtained inthe processing of step S31 and the cluster size (32 Kbytes) obtained inthe processing of step S32, the CPU 11 calculates the remaining capacityof the Memory Stick 31 for recording the moving-picture data in stepS35. The following describes this processing of step S35 with referenceto FIG. 8.

Referring to FIG. 8, there is shown the FAT data of one sector of theFATI 54 in the case of the 16-bit FAT system. It should be noted that,with reference to FIG. 8, similar components previously described withreference to FIG. 4 are denoted by the same reference numerals and theirdescription will be skipped for the brevity of description.

As with “0000”, “0010”, “0020”, and “0030” shown in FIG. 4, address“01f0” to the left of the figure is the internal address at which thedata of the FATI 54 are written, indicating the 32nd address from“0000”. Therefore, the second byte “00” forming entry c255 indicates the512th data from the first byte “f8” (the start data of the FAT data)forming entry c0.

The erasure block size obtained in the processing of step S31 is 128Kbytes and the cluster size obtained in the processing of step S32 is 32Kbytes, so that it is apparent that the data block (the erasure block)of the Memory Stick 31 is configured by four clusters and; as shown inFIG. 6, data block 0 of clusters 0 through 3 corresponds to erasureblock n and data block 1 of clusters 4 through 7 corresponds to erasureblock n+1.

Consequently, as shown in FIG. 8, the information of each cluster of theFAT data is also gathered up in correspondence to data block 0 (erasureblock n) with entries c0 through c3 being block b0. Likewise, entries c4through c7 are gathered up as block b1, entries c8 through c11 as blockb2, entries c12 through c15 as block b3, and entries c16 through c19 asblock 4. Further, entries c20 through c23 are gathered up as block b5,entries c24 through c27 as block b6, and entries c28 through c31 asblock b7. Still further, entries c248 through c251 are gathered up asblock b62 and entries c252 through c255 as block b63. Thus, the clusterinformation is also gathered up for each data block which is equivalentto the erasure block.

In this imaging apparatus 1, in recording moving-picture data, the CPU11 detects a data block of which clusters are all free from the startdata of the FATI 54 data and records the moving-picture data startingwith the clusters of the detected data block. Therefore, in step S35,the remaining capacity of this Memory Stick 31 is calculated on thebasis of the number of clusters of the detected data block.

For example, in the example shown in FIG. 8, the data blocks each ofwhich clusters (four clusters) are free areas “00” “00” are thosecorresponding to blocks b5 through b63. Only the clusters of these datablocks provide the free areas in the moving-picture mode. In block b4,entries c17 through c19 are “00” “00” but entry c16 is “ff” “ff”.Namely, clusters 17 through 19 are free areas but cluster 16 is used, sothat the data block corresponding to block b4 is not a free area.

Therefore, in this case, in step S36, the CPU 11 determines that thedata blocks corresponding to blocks b5, b6, b7, and so on are free areasand calculates the remaining capacity of the Memory Stick 31 on thebasis of the number of clusters in these data blocks.

In example shown in FIG. 8, the data block start position is adjustedsuch that it is matched with cluster 0 which is the logical firstcluster managed by the FAT, so that the boundary of one sector (the dataat the 512th byte, namely the second data of entry c 255) matches thedata block boundary (block b63). Consequently, in the detection of thedata blocks which are free areas, the FAT data may be detected byreading the FAT data sector by sector, so that the detection of the datablock which are free areas may be efficiently executed.

On the contrary, in the example shown in FIG. 9, no special adjustmentis performed on the data block start position and therefore the data ofthe data area 57 are recorded starting with cluster 2, which is thefirst of the substantially recordable area.

Therefore, as shown in FIG. 9, the information of each cluster of theFAT data is also gathered up in correspondence to data block 0 (erasureblock n) with entries c2 through c5 being block d0. Likewise, entries c6through c9 are gathered up as block d1, entries c10 through c13 as blockd2, entries c14 through c17 as block d3, and entries c18 through c21 asblock d4. Entries c22 through c25 are gathered up as block d5, entriesc26 through c29 as block d6, and entries c30 through c33 as block d7.Entries c246 through c249 are gathered up as block d61, entries c250through c253 as block d62, and entries c254 through c257 as block d63.

Namely, in the example shown in FIG. 9, block d63 to which data block 63including the data at the 512th byte which forms the boundary of onesector extends over two sectors, the sector shown in FIG. 9 and thefollowing sector. For the detection of this data block 63, it isnecessary to detect free areas in two sectors, the sector in whichentries c254 and c255 (the data at the 512th byte) exist and sector inwhich entries c256 (the data at the 513th byte, namely, the data at thefirst byte of the next sector) and entry c257 exist, thereby loweringthe detection speed.

Thus, the data block start position is adjusted such that it is matchedwith cluster 0, which is the logical first cluster managed by the FAT,so that, as compared with the case in which no such adjustment isexecuted, the detection of the data blocks of free areas may beefficiently executed.

Next, in step S37, the CPU 11 determines whether or not the imaging mode(set by the CPU 11 on the basis of the data entered through the inputunit 18) is the moving-picture mode. If the imaging mode is found to bethe moving-picture mode, then, in step S38, the CPU 11 determines on thebasis of the remaining capacity for the moving-picture mode calculatedin the processing of step S36 whether or not there is any remainingcapacity in the Memory Stick 31.

If any remaining capacity in the Memory Stick 31 is found in step S38,then, in step S39, the CPU 11 displays the remaining capacity on themonitor of the output unit 19 and sequentially records themoving-picture data to the flash memory 103 in units of data blocks (orerasure blocks), starting with the first data block of which clusters(four clusters) are all free areas, the first data block being detectedfrom the start data of the FAT data.

Namely, the CPU 11 manages the recording of data in units of clusters,whereas the CPU 101 records the data in units of erasure blocks. Thefour consecutive clusters to be recorded by the CPU 11 form one erasureblock, so that the CPU 101 may store the data of the four consecutiveclusters into the RAM 104, thereby quickly storing these data into theflash memory 103 as the data of one erasure block.

In step S40, the CPU 11 determines whether or not the recording of themoving-picture data has been completed. If the recording of themoving-picture data is found not completed, then the CPU 11 returns tostep S35 to repeat the above-mentioned processing therefrom. If therecording of the moving-picture data is found completed in step S40,then the recording processing comes to an end.

On the other hand, if the recording mode is found to be not themoving-picture mode (namely, it is found to be the still-picture mode)in step S37, then the CPU 11 determines in step S41 whether or not thereis any remaining capacity in the Memory Stick 31 on the basis of theremaining capacity for the still-picture mode calculated in theprocessing of step S35.

If any remaining capacity in the Memory Stick 31 is found in step S41,then the CPU 11 displays, in step S42, the remaining capacity on themonitor of the output unit 19 and sequentially records the still-picturedata in units of clusters, starting with the cluster which is the firstfree area, the cluster being detected from the start of the FAT data.

For example, as shown in FIG. 8, the CPU 11 instructs the CPU 101 todetect entry c17, which is the first “00” “00” (free area) in the FATdata and record the still-picture data in units of clusters to theclusters which are free areas, starting with cluster 17 corresponding todetected entry c17.

At this moment, the CPU 101 reads the data of the erasure blockcorresponding to block b4 (the data for four clusters) from the flashmemory 103 and temporarily stores the data into the RAM 104. Then, theCPU 101 updates, in the RAM 104, the data of the cluster correspondingto entry c17 by the data to be recorded, reads the data for fourclusters (one erasure block) again, and stores the data in thecorresponding erasure block.

The recording time is greater than that for moving-picture data, butstill-picture data are smaller in total data amount than moving-picturedata, so that the above-mentioned process does not present any problemsin practical use.

Then, in step S40, the CPU 11 determines whether or not the recording ofthe still-picture data has been completed. If the recording of thestill-picture data is found not completed, then the CPU 11 returns tostep S35 to repeat the above-mentioned processing therefrom. If therecording of the still-picture data is found completed in step S40, therecording processing comes to an end.

If the remaining capacity of the Memory Stick 31 is found nil in stepS38 or step S41, then the CPU 11 controls, in step S43, the output unit19 to display a message that there is no remaining capacity in theMemory Stick 31 onto the monitor.

It should be noted that, in the above description, if there is noremaining capacity of the Memory Stick 31, it is displayed on themonitor of the output unit 19 for example; it is also practicable todisplay how much remaining capacity there is in the Memory Stick 31 onthe basis of the obtained remaining capacity.

As described, the number of clusters equivalent to the erasure blocks ofthe Memory Stick 31 are gathered up as a data block and moving-picturedata are recorded in units of data blocks (namely, erasure blocks), sothat, if the erasure block size of the Memory Stick 31 gets larger,resulting in lowered recording speeds, the above-mentioned processingmay prevent the realtime recording from being disabled.

As described above, the data block start position is adjusted such thatit is matched with cluster 0, which is the logical first cluster managedby the FAT, so that, as compared with the case in which no suchadjustment is executed, the detection of data blocks, which are freeareas, may be efficiently executed.

Thus, because a conventional FAT file system of an OS is used, data maybe recorded to the Memory Stick 31 on general-purpose computers.Further, because the cluster size is not large, the usage efficiency ofthe memory space is not deteriorated.

In step S4 of the above-mentioned initialization processing describedwith reference to the flowchart of FIG. 5, the CPU 11 adjusts the datablock start position and executes the initialization processing on thebasis of data blocks. It is also practicable for the CPU 11 to instructthe CPU 101 to initialize the Memory Stick 31. In this case, the CPU 101initializes the flash memory 103 on the basis of the information of datablocks set to the device and the data block start position.

As described, when data of high bit rates such as moving-picture arerecorded, the data are recorded to free areas in units of data blockscorresponding to the erasure blocks in a loaded recording medium, sothat, if the erasure block size of the flash memory gets larger, thespeed of recording may be enhanced.

In the case of still-picture data, the data are recorded to free areasin units of clusters, so that wasted free areas may be prevented fromoccurring in the Memory Stick 31.

It should be noted that, if it is desired to prevent the recording speedfrom being lowered in the case of still-picture data, the data may berecorded in the above-mentioned units of data blocks. It is alsopracticable to let the user select between the increasing of recordingspeed and the increasing of recording capacity.

In the above-mentioned configuration, the Memory Stick functioning as aflash memory is used for the recording medium. It will be apparent thatthe present invention is applicable to other types of semiconductormemories.

The above-mentioned sequence of processing operations may be executednot only by hardware but also by software. In the software approach, theprograms constituting the software are installed from a program storagemedium into a computer incorporated in a dedicated hardware apparatus ora general-purpose personal computer for example which is able to executevarious functions by installing various programs.

A program storage medium for storing programs which are installed in acomputer and made executable by the computer is constituted by a packagemedia including a magnetic disk 41 (including flexible disk), an opticaldisk 42 (including CD-ROM (Compact Disc-Read Only Memory) and DVD(Digital Versatile Disc)), a magneto-optical disk (including MD(Mini-Disc) (trademark)), or a semiconductor memory 44 (including MemoryStick (trademark)) or the storage unit 20 in which programs are storedtemporarily or permanently as shown in FIG. 1.

It should be noted herein that the steps for describing each programrecorded in recording media include not only the processing operationswhich are sequentially executed in a time-series manner but also theprocessing operations which are executed concurrently or discretely.

It should be noted that the term system as used herein denotes an entireapparatus constituted by a plurality of apparatuses.

Industrial Applicability

As described and according to the invention, data may be recorded to arecording medium. In addition, according to the invention, even if theerasure block size of the recording medium gets larger, the speed ofrecording may be enhanced. Further, according to the invention, thelowering of the recording speed may be minimized while maintaining thecompatibility with general-purpose devices.

1. A recording apparatus for managing data in a recording medium inwhich data are recorded in units of an erasure block configured by aplurality of clusters, comprising: first detecting means for detectingsaid plurality of clusters which are free; second detecting means fordetecting said erasure block in which said plurality of clusters are allfree; and recording means for recording data to said plurality ofclusters of said erasure block detected by said second detecting means.2. The recording apparatus according to claim 1, wherein said recordingmemory is a flash memory.
 3. The recording apparatus according to claim1, wherein a FAT system is formed in said recording medium and saidfirst detecting means detects said plurality of free clusters from saidFAT.
 4. The recording apparatus according to claim 1, furthercomprising: first calculation means for calculating a remaining freecapacity of said recording medium from the number of said clustersdetected by said first detecting means; and second calculation means forcalculating a remaining free capacity of said recording medium from thenumber of said clusters of said erasure block detected by said seconddetecting means.
 5. The recording apparatus according to claim 4,further comprising determining means for determining whether or not datato be recorded to said recording medium is moving-picture data, whereinif said data to be recorded to said recording medium is found by saiddetermining means to be moving-picture data, then said recording meansrecords said data to said plurality of clusters of said erasure blockdetected by said second detecting means.
 6. The recording apparatusaccording to claim 4, still further comprising: determining means fordetermining whether or not data to be recorded to said recording mediumis still-picture data, wherein if said data to be recorded to saidrecording medium is found by said determining means to be still-picturedata, then said recording medium records said data to said plurality ofclusters detected by said first detecting means.
 7. The recording mediumaccording to claim 4, yet further comprising: display means fordisplaying a free remaining capacity of said recording medium obtainedby said first calculation means or said second calculation means.
 8. Therecording apparatus according to claim 7, further comprising:determining means for determining whether or not data to be recorded tosaid recording medium is moving-picture data, wherein if said data to berecorded to said recording medium is found by said determining means tobe moving-picture data, then said display means displays said remainingfree capacity of said recording medium obtained by said secondcalculation means.
 9. The recording apparatus according to claim 7,still further comprising: determining means for determining whether ornot data to be recorded to said recording medium is still-picture data,wherein if said data to be recorded to said recording medium is found bysaid determining means to be still-picture data, said display meansdisplays said remaining free capacity of said recording medium obtainedby said first calculation means.
 10. A recording method for a recordingapparatus for managing data in a recording medium in which data isrecorded in units of an erasure block configured by a plurality ofclusters, said recording method comprising: a first detecting step fordetecting said plurality of clusters which are free; a second detectingstep for detecting said erasure block in which said plurality ofclusters are all free; and a recording step for recording data to saidplurality of clusters of said erasure block detected by said seconddetecting step.
 11. A recording medium recording a program for arecording apparatus for managing data in a recording medium in whichdata are recorded in units of an erasure block configured by a pluralityof clusters, said program comprising: a first detecting step fordetecting said plurality of clusters which are free; a second detectingstep for detecting said erasure block in which said plurality ofclusters are all free; and a recording step for recording data to saidplurality of clusters of said erasure block detected by said seconddetecting step.
 12. A program executable by a computer for controlling arecording apparatus for managing data in a recording medium in whichdata is recorded in units of an erasure block configured by a pluralityof clusters, said program comprising: a first detecting step fordetecting said plurality of clusters which are free; a second detectingstep for detecting said erasure block in which said plurality ofclusters are all free; and a recording step for recording data to saidplurality of clusters of said erasure block detected by said seconddetecting step.